package com.ruoyi.common.utils.poi.word.render;

import com.ruoyi.common.utils.poi.XWPFDocumentUtil;
import lombok.Data;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import java.util.List;
import java.util.Map;

/**
 * 有key表格渲染
 */
@Data
public class PoiDataTableRow extends PoiDataBeforeCreateWord {
    /**
     * 表格index
     */
    protected int tableIndex;
    /**
     * 表格index
     */
    protected int startRow;
    /**
     * 值
     */
    protected List<Map<String, String>> value;

    public PoiDataTableRow(int tableIndex, int startRow, List<Map<String, String>> value) {
        this.tableIndex = tableIndex;
        this.startRow = startRow;
        this.value = value;
    }

    @Override
    public void handle(XWPFDocument document) throws Exception {
        super.handle(document);
        XWPFDocumentUtil.insertValueToTable(document, value, tableIndex, startRow);
    }
}
